import React,{useState,useEffect} from 'react'
import { NavBar } from 'antd-mobile'
import { useNavigate,useLocation } from "react-router-dom"
import { libraryDetails, libraryComment } from '../service/library';
import { HeartOutline } from 'antd-mobile-icons'

export default function LibraryCom() {
    let navigate = useNavigate();
    let state = useLocation();
    // console.log("state",state);
    
        const back = () =>{return navigate("/library/index");}
        
    
        const [libraryDetail, setlibraryDetail] = useState({imgUrl:"",description:"",address:"",businessHours:"",mapUrl:""});
        const [conment,setconment] = useState()  
        let search = async () => {
          let res = await libraryDetails(state.state.id)
          // console.log(res.data.data);
          setlibraryDetail(res.data.data);    
        }
      
        useEffect(() => {
          search()
        }, [])
        
        
  return (

      <div  className='libraryDetail-all'>
      <NavBar onBack={back}>{state.state.name}</NavBar>
      <div>
        <div className='contain'>
          <img className='libraryimg' src={"/api2" + libraryDetail.imgUrl} />
          <div className='content'>
            <div className='detail'>{libraryDetail.description}</div>
            <p>营业时间：{libraryDetail.businessHours}</p>
            {/* <img src={"/api2"+libraryDetail.mapUrl} /> */}
            <p>地址：{ libraryDetail.address}</p>
          </div>
          <div className='comment-all'>评论区：
            <div className='comment'>
              <p>嗯嗯嗯，很不错的图书馆，书很全</p>
              <HeartOutline className='icon' />
          </div>
          <div className='comment'>
              <p>这个图书馆挺不错的</p>
              <HeartOutline className='icon' />
          </div>
          <div className='comment'>
              <p>嗯嗯嗯，很不错的图书馆，书很全</p>
              <HeartOutline className='icon' />
          </div>
          <div className='comment'>
              <p>嗯嗯嗯，很不错的图书馆，书很全</p>
              <HeartOutline className='icon' />
          </div>
          <div className='comment'>
              <p>嗯嗯嗯，很不错的图书馆，书很全</p>
              <HeartOutline className='icon' />
          </div>
          <div className='comment'>
              <p>嗯嗯嗯，很不错的图书馆，书很全</p>
              <HeartOutline className='icon' />
            </div>
            </div>
          
        </div>
      </div>
    </div>
  )
}
